<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>新增资金流动记录</title>
    <th:block th:include="~{common/common::commonHead}"/>
</head>
<body data-width="400" data-height="350">
<div class="container-fluid">
    <form class="form-horizontal" role="form" th:action="@{/prisonerCapitalFlow/addPrisonerCapitalFlow}">
        <div class="form-group">
            <label class="col-xs-4 control-label"> 流动类型：</label>
            <div class="col-xs-8">
                <select id="type" name="type" class="form-control spinner" onchange="test();" required>
                    <option value="">请选择流动类型</option>
                    <option value="1">收入</option>
                    <option value="0">支出</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label"> 变动名称：</label>
            <div class="col-xs-8">
                <select id="flowType" name="flowType" class="form-control spinner" required>
                    <option>请选择变动名称</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label"> 流动资金：</label>
            <div class="col-xs-8">
                <input id="flowMoney" name="flowMoney" type="text" class="form-control spinner" data-valid-decimal="true" data-decimal="true" required maxlength="20" placeholder="1~20位字符">
            </div>
        </div>
    </form>
</div>
</body>
</html>
<script>
    function test(){
            var type = $("#type").val();
            if(type===""||type===undefined||type===null){
                $.error("请选择流动类型");
                return ;
            }
            $.doAjax("flowType/listFlowType",{type:type},function(data){
                $("#flowType").empty();
                for(var i=0;i<data.length;i++){
                    $("#flowType").append("<option value='" + data[i].id + "'>" + data[i].name + "</option>");
                }
            })
    }
</script>